package celular.criar;
import celular.FormAdministracao;
import celular.Main;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;



public class FormCriar extends Form implements CommandListener
{
	
	private Command commandAdministracao, commandSalvar;
	private TextField textTitulo;
	private TextField textDescriao;
	private Main main;
	private String TIPO_DADO_CRIAR;
	
	public FormCriar(String titulo, Main main, String TIPO_DADO_CRIAR)
	{
		
		super(titulo);
		this.main = main;
		this.TIPO_DADO_CRIAR = TIPO_DADO_CRIAR;
		this.commandAdministracao = new Command("Administracao", Command.OK, 0);	
		this.commandSalvar = new Command("Salvar", Command.OK, 1);	

		addCommand(this.commandAdministracao);	
		addCommand(this.commandSalvar);

		append(this.textTitulo = new TextField("Titulo :", "", 60, TextField.ANY));
		append(this.textDescriao = new TextField(TIPO_DADO_CRIAR+":", "", 200, TextField.ANY | TextField.PASSWORD));
		setCommandListener(this);   
		
		
	}
	
	public void commandAction(Command c, Displayable d)
	{
		if (c == this.commandAdministracao)
			this.main.getTela().setCurrent(new FormAdministracao("Administracao", this.main));
		
		if (c == this.commandSalvar) {			
			salvar();			
			this.main.getTela().setCurrent(new FormAdministracao("Administracao", this.main));
		}
	}
	
	public void salvar(){
		
	}
	
}
